package com.demo.threadpool;

import org.apache.commons.lang3.concurrent.BasicThreadFactory;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;

public class PoolDemo {
    public static ExecutorService getPool(int poolSize) {
        ExecutorService executorService = new ScheduledThreadPoolExecutor(poolSize,
                new BasicThreadFactory.Builder().namingPattern("demo-pool-%d").daemon(true).build());

        return executorService;
    }
}
